/**
 * @date 1:56:19 PM
 * Education_Admin.java
 * Administrator
 * TODO
 */
package com.qs.education.bean.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.Getter;
import lombok.Setter;

/**
 * @class Education_Admin：后台管理员实体
 * @author Brooks
 * @description 
 * @date Oct 17, 2018
 */
@Entity
@Table(name="education_admin")
//@Data
@Getter
@Setter
public class EducationAdmin {
	@Id
	@Column(name="id" ,unique=true,nullable=false)
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	
	@Column(name="name",unique=true,nullable=false)
	private String name;
	private String password;
	private String mobile;
	private String email;
	
	@ManyToMany
	@JoinTable(
		name="education_admin_role",
		joinColumns={@JoinColumn(name="admin_id",referencedColumnName="id")},
		inverseJoinColumns={@JoinColumn(name="role_id",referencedColumnName="id")}
	)
	@JsonIgnoreProperties(value = { "admins" })
	private Set<EducationRole> roles = new HashSet<>();
}
